/*
 * Copyright 2020-2030 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.gitee.minimalismstyle.fresh.gateway.config

import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.NestedConfigurationProperty

/**
 * 验证码配置参数
 * @author maoxiaodong
 */
@ConfigurationProperties(prefix = "fresh.captcha.kaptcha")
class KaptchaProperties {

    /**
     * 宽度
     */
    var width = 200

    /**
     * 高度
     */
    var height = 50

    /**
     * 内容
     */
    @NestedConfigurationProperty
    internal var content = Content()

    /**
     * 背景色
     */
    @NestedConfigurationProperty
    internal var backgroundColor = BackgroundColor()

    /**
     * 字体
     */
    @NestedConfigurationProperty
    internal var font = Font()

    /**
     * 边框
     */
    @NestedConfigurationProperty
    internal var border = Border()

    internal class BackgroundColor {

        /**
         * 开始渐变色
         */
        var from = "lightGray"

        /**
         * 结束渐变色
         */
        var to = "white"

    }

    internal class Content {

        /**
         * 内容源
         */
        var source = "abcdefghjklmnopqrstuvwxyz23456789"

        /**
         * 内容长度
         */
        var length = 4

        /**
         * 内容间隔
         */
        var space = 2

    }

    internal class Border {

        /**
         * 是否开启
         */
        var enabled = true

        /**
         * 颜色
         */
        var color = "black"

        /**
         * 厚度
         */
        var thickness = 1

    }

    internal class Font {

        /**
         * 名称
         */
        var name = "Arial"

        /**
         * 颜色
         */
        var color = "black"

        /**
         * 大小
         */
        var size = 40

    }

}
